package edu.wit.common.api.domain;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonProperty;
import edu.wit.common.annotation.Excel;
import edu.wit.common.annotation.Excel.*;
import edu.wit.common.annotation.Excels;
import edu.wit.common.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;

import javax.validation.constraints.Email;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * 用户对象 sys_user
 * 
 * @author ruoyi
 */
@Data
public class SysUser extends BaseEntity {
    private static final long serialVersionUID = 1L;

    /** 用户ID */
    @TableId(value = "id", type = IdType.ID_WORKER_STR)
    @Excel(name = "用户序号", cellType = ColumnType.NUMERIC, prompt = "用户编号")
    private String id;

    /** 部门ID */
//    @Excel(name = "部门编号", type = Type.IMPORT)
//    private Long deptId;

    /** 用户账号 */
    @Excel(name = "登录名称")
    private String username;

    /** 用户昵称 */
    @Excel(name = "用户名称")
    private String nickName;

    /** 用户邮箱 */
    @Excel(name = "用户邮箱")
    private String email;

    /** 手机号码 */
    @Excel(name = "手机号码")
    private String phonenumber;

    /** 用户性别 */
    @Excel(name = "用户性别", readConverterExp = "0=男,1=女,2=未知")
    private String sex;

    /** 用户头像 */
    private String salt;

    /** 密码 */
    private String password;

//    /** 盐加密 */
//    private String salt;

    /** 帐号状态（0正常 1停用） */
    @Excel(name = "帐号状态", readConverterExp = "0=正常,1=停用")
    private String status;

    /** 删除标志（0代表存在 1代表删除） */
    private Integer isDeleted;

    /** 最后登录IP */
    @Excel(name = "最后登录IP", type = Excel.Type.EXPORT)
    private String loginIp;

    /** 最后登录时间 */
    @Excel(name = "最后登录时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss", type = Excel.Type.EXPORT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date loginDate;

//    /** 部门对象 */
//    @Excels({
//        @Excel(name = "部门名称", targetAttr = "deptName", type = Excel.Type.EXPORT),
//        @Excel(name = "部门负责人", targetAttr = "leader", type = Type.EXPORT)
//    })
//    private SysDept dept;

    /** 角色对象 */
//    private List<SysRole> roles;

//    /** 角色组 */
//    private Long[] roleIds;

//    /** 岗位组 */
//    private Long[] postIds;

    /** 角色ID */
    private String roleId;

    private Integer category;

    @ApiModelProperty(value = "父节点")
    private String pid;

    @ApiModelProperty(value = "所属企业")
    private String enterpriseName;

    @ApiModelProperty(value = "用户角色")
//    @TableField(fill = FieldFill.INSERT_UPDATE,exist = false)
    private String roleName;
}
